package 笔试真题;

import java.util.*;
// 1 3 7 15
// 0 1 0 1
public class Tengxun24 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int start = scanner.nextInt()-1;
        int end = scanner.nextInt()-1;
        ArrayList<Integer> temp = new ArrayList<>();
        while (n!=0){
            temp.add(n%2);
            n/=2;
        }
        List<Integer> ans = new ArrayList<>();
        for (int i = temp.size()-1; i >= 0; i--) {
            int an = temp.get(i);
            ArrayList arrayList = new ArrayList(ans);
            ans.add(an);
            ans.addAll(arrayList);
        }
        int num = 0;
        for (int i = start  ; i <= end; i++) {
            if (ans.get(i) == 1) {
                num ++;
            }
        }
        System.out.println(num);
    }

}
